//
//  GradientView.swift
//  MGOA-iOS
//
//  Created by zhongshan on 2022/3/9.
//

import UIKit

class GradientView: UIView {
    var colors: [Any]? {
        set {
            gradientLayer.colors = newValue
        }
        get {
            return gradientLayer.colors
        }
    }
    var locations: [NSNumber]? {
        set {
            gradientLayer.locations = newValue
        }
        get {
            return gradientLayer.locations
        }
    }
    var startPoint: CGPoint {
        set {
            gradientLayer.startPoint = newValue
        }
        get {
            return gradientLayer.startPoint
        }
    }
    var endPoint: CGPoint {
        set {
            gradientLayer.endPoint = newValue
        }
        get {
            return gradientLayer.endPoint
        }
    }
    var type: CAGradientLayerType {
        set {
            gradientLayer.type = newValue
        }
        get {
            return gradientLayer.type
        }
    }
    
    private var gradientLayer: CAGradientLayer {
        return layer as! CAGradientLayer
    }
    
    override class var layerClass: AnyClass {
        return CAGradientLayer.self
    }

}
